﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace RoleHelper
{
    class MiDibujo: PictureBox
    {
        public bool pressed = false;
        public char tipo;
        public ContextMenuStrip menu;
        public MiDibujo(object pare, Image imagen, Color back, char type)
        {
            Parent = (PositioningXpress)pare;
            Top = MousePosition.Y - Parent.Location.Y - 85;
            tipo = type;
            Left = MousePosition.X - Parent.Location.X - 30;
            if (tipo == 'P')
            {
                Image = imagen;
                this.Size = imagen.Size;
            }
            else
            {
                Width = 30;
                Height = 70;
            }
                //RoleHelper.Properties.Resources.punto_verde;
            BackColor=back;
            this.MouseDown += new MouseEventHandler(MiDibujo_MouseDown);
            this.MouseUp += new MouseEventHandler(MiDibujo_MouseUp);
            this.MouseMove += new MouseEventHandler(MiDibujo_MouseMove);
            menu= new ContextMenuStrip();
            menu.Items.Add("hola",null,redimensionarmenu_Click);
            this.ContextMenuStrip = menu;
            
        }
        private void MiDibujo_MouseDown(object sender, MouseEventArgs e)
        {
            pressed = true;
        }

        private void MiDibujo_Move(object sender, MouseEventArgs e, Point punto)
        {
        }

        private void MiDibujo_MouseMove(object sender, MouseEventArgs e)
        {

            if (pressed)
            {
                Top = MousePosition.Y - Parent.Location.Y - 80;
                Left = MousePosition.X - Parent.Location.X - 30;
            }
        }

        private void redimensionarmenu_Click(object sender, EventArgs e)
        {


        }

        private void MiDibujo_MouseUp(object sender, MouseEventArgs e)
        {
            pressed = false;
        }
    }
}
